package com.zhengtoon.mctoon.conv.controller;

import com.bjtoon.framework.entity.ResponseResult;
import com.qitoon.framework.core.exception.BusinessException;
import com.zhengtoon.mctoon.conv.bean.session.OrgSessionInfo;
import com.zhengtoon.mctoon.conv.dto.*;
import com.zhengtoon.mctoon.conv.dto.mybatis.Page;
import com.zhengtoon.mctoon.conv.exception.ConvPhotoExceptionCode;
import com.zhengtoon.mctoon.conv.service.ConvPhotoInfoService;
import com.zhengtoon.mctoon.conv.utils.AppConstant;
import com.zhengtoon.mctoon.conv.utils.SessionUtils;
import com.zhengtoon.mctoon.conv.utils.XssEncodeUtils;
import com.zhengtoon.mctoon.conv.vo.*;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/convphotoManage")
@Api(value = "convphotoMange服务", description = "convphotoMange服务")
public class ConvPhotoMangeController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(ConvPhotoMangeController.class);


    @Autowired
    private ConvPhotoInfoService convPhotoInfoService;

    /**
     * 待审核列表
     *
     * @param auditListQueryDto 查询条件
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "待审核列表", httpMethod = "POST", notes = "待审核列表")
    @RequestMapping(value = "/queryPendingAuditList", method = RequestMethod.POST)
    public ResponseResult<Page> queryPendingAuditList(
            @ApiParam(required = true, name = "auditListQueryDto", value = "auditListQueryDto")
            @RequestBody @Valid PendingAuditListQueryDto auditListQueryDto) {
        try {

            // 1.参数校验
            if (auditListQueryDto.getPageNum() == null
                    || auditListQueryDto.getPageSize() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 设置默认排序
            if (auditListQueryDto.getIsAsc() == null) {
                auditListQueryDto.setIsAsc(AppConstant.SORT_IS_ASC_NO);
            }

            Page page = new Page(auditListQueryDto.getPageNum(), auditListQueryDto.getPageSize());

            page.setParam(auditListQueryDto);

            // 2. 调用service接口
            Page pageResult = convPhotoInfoService.queryPendingAuditList(page);

            // 3. 返回数据

            return ResponseResult.success(pageResult);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryPendingAuditList()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryPendingAuditList()方法error");
        }
    }

    /**
     * 待审核详情
     *
     * @param pendingAuditDetailVo 待审核vo
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "待审核详情 ", httpMethod = "POST", notes = "待审核详情")
    @RequestMapping(value = "/queryPendingAuditDetailById", method = RequestMethod.POST)
    public ResponseResult<PendingAuditDetailDto> queryPendingAuditDetailById(
            @ApiParam(required = true, name = "convVo", value = "convVo")
            @RequestBody @Valid PendingAuditDetailVo pendingAuditDetailVo) {
        try {
            // 1.参数校验
            if (pendingAuditDetailVo.getId() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 2. 调用service接口
            PendingAuditDetailDto detailDto = convPhotoInfoService.queryPendingAuditDetailById(pendingAuditDetailVo.getId());

            // 3. 返回数据
            return ResponseResult.success(detailDto);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryPendingAuditDetailById()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryPendingAuditDeta                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ilById()方法error");
        }
    }

    /**
     * 下一个未处理的详情
     *
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "下一个未处理的详情 ", httpMethod = "POST", notes = "下一个未处理的详情")
    @RequestMapping(value = "/queryPendingAuditDetailByNext", method = RequestMethod.POST)
    public ResponseResult queryPendingAuditDetailByNext(@ApiParam(required = true, name = "queryPendingNextVo", value = "queryPendingNextVo")
                                                        @RequestBody @Valid QueryPendingNextVo queryPendingNextVo) {
        try {
            // 1.参数校验

            if (queryPendingNextVo.getIsAsc() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 2. 调用service接口
            PendingAuditDetailDto dto = convPhotoInfoService.queryPendingAuditDetailByNext(queryPendingNextVo.getIsAsc());

            // 3. 返回数据
            return ResponseResult.success(dto);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryNextPendingAuditDetailByCreateTime()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryNextPendingAuditDetailByCreateTime()方法error");
        }
    }

    /**
     * 调用审核所需配置项
     *
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "调用审核所需配置项 ", httpMethod = "POST", notes = "调用审核所需配置项")
    @RequestMapping(value = "/auditConfig", method = RequestMethod.POST)
    public ResponseResult auditConfig() {
        try {
            // 1.参数校验

            // 2. 调用service接口
            AuditConfigDto dto = convPhotoInfoService.auditConfig();

            // 3. 返回数据
            return ResponseResult.success(dto);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("auditConfig()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "auditConfig()方法error");
        }
    }

    /**
     * 获取审核前通知详情 144637
     *
     * @param addAuditDto addAuditDto
     * @return ResponseResult
     * 144637
     */
    @ApiOperation(value = "获取审核前通知详情", httpMethod = "POST", notes = "获取审核前通知详情")
    @RequestMapping(value = "/queryMsgContentBeforeAudit", method = RequestMethod.POST)
    public ResponseResult queryMsgContentBeforeAudit(
            @ApiParam(required = true, name = "addReportDto", value = "addReportDto")
            @RequestBody @Valid AddAuditDto addAuditDto) {
        try {
            // 1.参数校验
            if (addAuditDto.getAuditStatus() == null || StringUtils.isAnyBlank(addAuditDto.getId())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
                // 不通过
            }
            if (AppConstant.CONV_AUDIT_NOT_PASS.equals(addAuditDto.getAuditStatus())
                    && StringUtils.isBlank(addAuditDto.getRejectReason())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 不通过 ,其他原因
            if (AppConstant.CONV_AUDIT_NOT_PASS.equals(addAuditDto.getAuditStatus())
                    && addAuditDto.getRejectReason().contains(AppConstant.OTHER_REJECT_DICT_CODE + "")
                    && StringUtils.isBlank(addAuditDto.getOtherRejectReason())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            boolean isPass = AppConstant.CONV_AUDIT_PASS.equals(addAuditDto.getAuditStatus());
            // 通过
            if (isPass && addAuditDto.getDealType() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 2. 调用service接口
            String msgCotent = convPhotoInfoService.queryMsgContentBeforeAudit(addAuditDto);

            // 3. 返回数据
            return ResponseResult.success(msgCotent);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryMsgContentBeforeAudit()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryMsgContentBeforeAudit()方法error");
        }
    }

    /**
     * 审核接口
     *
     * @param addAuditDto 审核dto
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "审核接口 ", httpMethod = "POST", notes = "审核接口")
    @RequestMapping(value = "/addAudit", method = RequestMethod.POST)
    public ResponseResult addAudit(
            @ApiParam(required = true, name = "addAuditDto", value = "addAuditDto")
            @RequestBody @Valid AddAuditDto addAuditDto) {
        try {

            // 1.参数校验
            if (addAuditDto.getAuditStatus() == null
                    || StringUtils.isAnyBlank(addAuditDto.getId())
                    || StringUtils.isBlank(addAuditDto.getMsgContent())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 不通过
            if (AppConstant.CONV_AUDIT_NOT_PASS.equals(addAuditDto.getAuditStatus())
                    && StringUtils.isBlank(addAuditDto.getRejectReason())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 不通过 ,其他原因
            if (AppConstant.CONV_AUDIT_NOT_PASS.equals(addAuditDto.getAuditStatus())
                    && addAuditDto.getRejectReason().contains(AppConstant.OTHER_REJECT_DICT_CODE + "")
                    && StringUtils.isBlank(addAuditDto.getOtherRejectReason())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            boolean isPass = AppConstant.CONV_AUDIT_PASS.equals(addAuditDto.getAuditStatus());

            // 通过
            if (isPass && addAuditDto.getDealType() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            OrgSessionInfo orgSessionInfo = SessionUtils.getSessionInfo();

            addAuditDto.setMsgContent(XssEncodeUtils.xssEncode(addAuditDto.getMsgContent()));
            addAuditDto.setOtherRejectReason(XssEncodeUtils.xssEncode(addAuditDto.getOtherRejectReason()));
            addAuditDto.setRejectReason(XssEncodeUtils.xssEncode(addAuditDto.getRejectReason()));
            if (StringUtils.isNotBlank(addAuditDto.getIntegralMatters())) {
                addAuditDto.setIntegralMatters(XssEncodeUtils.xssEncode(addAuditDto.getIntegralMatters()));
            }

            boolean success = convPhotoInfoService.addAudit(addAuditDto, orgSessionInfo);

            if (success) {
                return ResponseResult.success(success);
            }

            return ResponseResult.fail(AppConstant.FAIL_CODE, "随手拍记录审核失败");
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("addAudit()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "addAudit()方法error");
        }
    }

    /**
     * 举报列表
     *
     * @param reportListQueryDto 入参dto
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "举报列表", httpMethod = "POST", notes = "举报列表")
    @RequestMapping(value = "/queryReportList", method = RequestMethod.POST)
    public ResponseResult queryReportList(
            @ApiParam(required = true, name = "reportListQueryDto", value = "reportListQueryDto")
            @RequestBody @Valid ReportListQueryDto reportListQueryDto) {
        try {
            // 1.参数校验
            if (reportListQueryDto.getPageNum() == null
                    || reportListQueryDto.getPageSize() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 设置默认排序
            if (reportListQueryDto.getIsAsc() == null) {
                reportListQueryDto.setIsAsc(AppConstant.SORT_IS_ASC_NO);
            }

            Page page = new Page(reportListQueryDto.getPageNum(), reportListQueryDto.getPageSize());

            page.setParam(reportListQueryDto);

            // 2. 调用service接口
            Page pageResult = convPhotoInfoService.queryReportList(page);

            // 3. 返回数据
            return ResponseResult.success(pageResult);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryReportList()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryReportList()方法error");
        }
    }

    /**
     * 举报详情
     *
     * @param reportDetailVo 举报详情vo
     * @return ResponseResult
     * @author 144637
     */
    @ApiOperation(value = "举报详情 ", httpMethod = "POST", notes = "举报详情")
    @RequestMapping(value = "/queryReportById", method = RequestMethod.POST)
    public ResponseResult queryReportById(
            @ApiParam(required = true, name = "convVo", value = "convVo")
            @RequestBody @Valid ReportDetailVo reportDetailVo) {
        try {
            // 1.参数校验
            if (reportDetailVo.getId() == null || reportDetailVo.getIsEdit() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 2. 调用service接口
            ReportDetailDto detailDto = convPhotoInfoService.queryReportById(reportDetailVo.getId(), reportDetailVo.getIsEdit());

            // 3. 返回数据
            return ResponseResult.success(detailDto);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryReportById()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryReportById()方法error");
        }
    }

    /**
     * 获取处理举报前通知详情 144637
     *
     * @param addReportDto 处理举报dto
     * @return ResponseResult
     * 144637
     */
    @ApiOperation(value = "获取处理举报前通知详情", httpMethod = "POST", notes = "获取处理举报前通知详情")
    @RequestMapping(value = "/queryMsgContentBeforeAuditReport", method = RequestMethod.POST)
    public ResponseResult queryMsgContentBeforeAuditReport(
            @ApiParam(required = true, name = "addReportDto", value = "addReportDto")
            @RequestBody @Valid AddReportDto addReportDto) {
        try {
            // 1.参数校验
            if (addReportDto.getId() == null
                    || addReportDto.getReportType() == null
                    || addReportDto.getReportStatus() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 客服自处理,需要校验处理途径和结果
            if (addReportDto.getReportType().equals(AppConstant.HANDLE_MODEL_SERVICE)
                    && StringUtils.isAnyBlank(addReportDto.getReportChannel(), addReportDto.getReportResult())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 首都之窗,不校验处理途径和结果
            if (addReportDto.getReportType().equals(AppConstant.HANDLE_MODEL_BJ_WINDOW)
                    && StringUtils.isAnyBlank(addReportDto.getTitle())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 2. 调用service接口
            String msgCotent = convPhotoInfoService.queryMsgContentBeforeAuditReport(addReportDto);

            // 3. 返回数据

            return ResponseResult.success(msgCotent);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryMsgContentBeforeAuditReport()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryMsgContentBeforeAuditReport()方法error");
        }
    }


    /**
     * 处理举报 144637
     *
     * @param addReportDto 处理举报dto
     * @return ResponseResult
     * 144637
     */
    @ApiOperation(value = "处理举报 ", httpMethod = "POST", notes = "处理举报")
    @RequestMapping(value = "/addReport", method = RequestMethod.POST)
    public ResponseResult addReport(
            @ApiParam(required = true, name = "addReportDto", value = "addReportDto")
            @RequestBody @Valid AddReportDto addReportDto) {
        try {

            // 1.参数校验
            if (addReportDto.getId() == null
                    || addReportDto.getReportType() == null
                    || addReportDto.getReportStatus() == null
                    || StringUtils.isBlank(addReportDto.getMsgContent())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 客服自处理,需要校验处理途径和结果
            if (addReportDto.getReportType().equals(AppConstant.HANDLE_MODEL_SERVICE)
                    && StringUtils.isAnyBlank(addReportDto.getReportChannel(), addReportDto.getReportResult())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 首都之窗,不校验处理途径和结果
            if (addReportDto.getReportType().equals(AppConstant.HANDLE_MODEL_BJ_WINDOW)
                    && StringUtils.isAnyBlank(addReportDto.getTitle())) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            OrgSessionInfo orgSessionInfo = SessionUtils.getSessionInfo();

            addReportDto.setReportChannel(XssEncodeUtils.xssEncode(addReportDto.getReportChannel()));
            addReportDto.setReportResult(XssEncodeUtils.xssEncode(addReportDto.getReportResult()));
            addReportDto.setMsgContent(XssEncodeUtils.xssEncode(addReportDto.getMsgContent()));
            if (StringUtils.isNotBlank(addReportDto.getTitle())) {
                addReportDto.setTitle(XssEncodeUtils.xssEncode(addReportDto.getTitle()));
            }

            boolean success = convPhotoInfoService.addReport(addReportDto, orgSessionInfo);

            // 3. 返回数据

            if (success) {
                return ResponseResult.success(success);
            }

            return ResponseResult.fail(AppConstant.FAIL_CODE, "处理举报失败");
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("addReport()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "addReport()方法error");
        }
    }

    /**
     * 已发布的随手拍列表   144637
     *
     * @param publishedDto 已发布的随手拍dto
     * @return ResponseResult
     * 144637
     */
    @ApiOperation(value = "已发布的随手拍列表 ", httpMethod = "POST", notes = "已发布的随手拍列表")
    @RequestMapping(value = "/queryPublishedConvList", method = RequestMethod.POST)
    public ResponseResult queryPublishedConvList(
            @ApiParam(required = true, name = "reportListQueryDto", value = "reportListQueryDto")
            @RequestBody @Valid PublishedConvListQueryDto publishedDto) {
        try {

            // 1.参数校验
            if (publishedDto.getPageNum() == null
                    || publishedDto.getPageSize() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            // 设置默认排序
            if (publishedDto.getIsAsc() == null) {
                publishedDto.setIsAsc(AppConstant.SORT_IS_ASC_NO);
            }


            Page page = new Page(publishedDto.getPageNum(), publishedDto.getPageSize());

            page.setParam(publishedDto);

            // 2. 调用service接口
            Page pageResult = convPhotoInfoService.queryPublishedConvList(page);

            // 3. 返回数据
            return ResponseResult.success(pageResult);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("queryReportDoneList()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "queryReportDoneList()方法error");
        }
    }

    /**
     * 已发布的随手拍详情 144637
     *
     * @param convlVo 随手拍详情vo
     * @return Resp144637
     * onseResult
     */
    @ApiOperation(value = "已发布的随手拍详情", httpMethod = "POST", notes = "已发布的随手拍详情")
    @RequestMapping(value = "/queryPublishedConvDetailById", method = RequestMethod.POST)
    public ResponseResult queryPublishedConvDetailById(
            @ApiParam(required = true, name = "convVo", value = "convVo")
            @RequestBody @Valid PublishConvVo convlVo) {
        try {

            // 1.参数校验
            if (convlVo.getId() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }
            // 2. 调用service接口
            PublishedConvDetailDto detailDto = convPhotoInfoService.queryPublishedConvDetailById(convlVo.getId());

            // 3. 返回数据
            return ResponseResult.success(detailDto);
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("getReportDoneDetailById()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "getReportDoneDetailById()方法error");
        }
    }

    /**
     * 解锁随手拍记录   144637
     *
     * @param unlockAuditRecordVo 解锁随手拍记录vo
     * @return ResponseResult
     * 144637
     */
    @ApiOperation(value = "解锁随手拍记录 ", httpMethod = "POST", notes = "解锁随手拍记录")
    @RequestMapping(value = "/unlockAuditRecord", method = RequestMethod.POST)
    public ResponseResult unlockAuditRecord(
            @ApiParam(required = true, name = "unlockAuditRecordVo", value = "unlockAuditRecordVo")
            @RequestBody @Valid UnlockAuditRecordVo unlockAuditRecordVo) {
        try {

            // 1.参数校验
            if (unlockAuditRecordVo.getConvId() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            }

            boolean success = convPhotoInfoService.unlockAuditRecord(unlockAuditRecordVo.getConvId());

            if (success) {
                return ResponseResult.success(success);
            }

            return ResponseResult.fail(AppConstant.FAIL_CODE, "随手拍记录解锁失败");
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("unlockAuditRecord()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "unlockAuditRecord()方法error");
        }
    }

    /**
     * 对外隐藏或显示 144637
     *
     * @param convVo
     * @return ResponseResult
     */
    @ApiOperation(value = "对外隐藏或显示 ", httpMethod = "POST", notes = "对外隐藏或显示")
    @RequestMapping(value = "/switchShowOrHide", method = RequestMethod.POST)
    public ResponseResult switchShowOrHide(
            @ApiParam(required = true, name = "convVo", value = "convVo")
            @RequestBody @Valid SwitchConvVo convVo) {
        try {
            // 1.参数校验
            if (convVo.getId() == null || convVo.getShowFlag() == null) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_NULL);
            } else if (convVo.getShowFlag() >= 3 || convVo.getShowFlag() < 0) {
                return new ResponseResult<>(ConvPhotoExceptionCode.PARAM_IS_FAIL);
            }

            //是否对外隐藏（1：展示, 2:不展示）
            Long convId = Long.valueOf(convVo.getId());
            Integer showFlag = convVo.getShowFlag();

            int row = convPhotoInfoService.updShowFlag(convId, showFlag);
            if (row == 1) {
                return ResponseResult.success("成功");
            }
            return ResponseResult.fail(AppConstant.FAIL_CODE, "修改状态失败");
        } catch (BusinessException e1) {
            return new ResponseResult<>(AppConstant.FAIL_CODE, e1.getMessage());
        } catch (Exception e) {
            log.error("switchView()方法error", e);
            return ResponseResult.fail(AppConstant.ERROR_CODE, "switchView()方法error");
        }
    }

}